package com.mycompany.app.hr.pa.service;

import java.util.Date;
import java.util.List;
import java.util.Set;

import com.mycompany.app.hr.pa.model.Employee;

public interface IEmployeeService {

    public List<Employee> findDirectSubordinates(String empId);

    public Employee findDirectReport(String subEmpId);

    /**
     * subordinates ternanation day before date
     * @param empId
     * @param date
     * @return
     */
    public List<Employee> findDirectSubordinatesBeforeDay(String empId,
            Date date);
    
    /**
     * get all valid subordinate gid whose termination day after input date.
     * 
     * @param gid
     * @param date
     * @return
     */
    public List<String> getAllValidSubordinateId(String gid,Date date);

    /*
     * if in supervisor's subordinate set, return true. else return false.
     * The set is stored in supervisor's session after successful log in , 
     * and it will became invalid and be cleared after log out.
     */
    public boolean isInSubordinateSet(String gid, Set<String> subordinateSet);

    /**
     *  function is_employee_in_service (
            v_gid in employee.gid %type,
            v_working_day in date
    ) return boolean
    is
    begin
       for idx in (
           select e.gid from employee e
           where e.gid = v_gid and e.is_expatriate = 'N' and e.need_ta_manage = 'Y'
                 and ( (e.latest_termination_date is not null and v_working_day <= e.latest_termination_date)
                    or (e.valid_flag = 1 and v_working_day >= e.latest_hire_date)
                    or (e.valid_flag = 0 and v_working_day between e.latest_hire_date and e.termination_date) )
       ) loop
           return true;
       end loop;

       return false;
    end;
     */
    public boolean isEmployeeInService(String gid, Date workingDate);
    
    
    public double getWorkingYear(Employee emp);
    
    public double getServiceYear(Employee emp);
    
    
    /**
     * differentiate by group and subgroup
     * @param gid
     * @return
     */
    //=======================================//
    public boolean isDL(String gid);
    public boolean isExpatriate(String gid);
    public boolean isManager(String gid);
  //=======================================//

}
